package com.bm.api.controller;

import com.bm.api.service.TeacherService;
import com.bm.common.dto.StudentDto;
import com.bm.common.dto.TeacherDto;
import com.bm.common.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: 赵金帅
 * @Date: 2022/07/24/15:15
 */
@RestController
@RequestMapping("/api/tea")
@Api(tags = "实现师徒关系查询和添加-赵金帅 ")
public class TeacherController {
    @Resource
    private TeacherService service;
    @ApiOperation(value = "查询师傅信息")
    @GetMapping("selecttea.do")
    public R selectTea(){
        return service.selectTea();
    }
    @ApiOperation(value = "查询徒弟信息")
    @GetMapping("selectstu.do")
    public R selectStu(@RequestParam Integer tid){
        return service.selectStu(tid);
    }
    @ApiOperation(value = "拜师")
    @PostMapping("savestu.do")
    public R saveStu(@RequestBody StudentDto dto){
        return service.saveStu(dto);
    }
    @ApiOperation(value = "成为师傅")
    @PostMapping("savetea.do")
    public R saveTea(@RequestBody TeacherDto dto){
        return service.saveTea(dto);
    }
}
